package main

import "fmt"

type Books struct {
	title   string
	author  string
	subject string
	book_id int
}

func printBook(book Books) { //结构体作为函数参数
	fmt.Println("Book author:", book.author)
}

func printTitle(title *Books) { //结构体指针
	fmt.Println("Book title:", title.title)
}

/*func main() {
	fmt.Println(Books{"go语言", "bluemooder", "go学习教程", 12})
	fmt.Println(Books{title: "go语言", author: "bluemooder", subject: "go学习教程", book_id: 123})
	fmt.Println(Books{title: "go语言", subject: "go学习教程"})
}*/
var Book2 = Books{"Java语言", "bluemooder", "Java学习教程", 13}

func main() {
	Book1 := Books{"go语言", "bluemooder", "go学习教程", 12}
	fmt.Println(Book1.subject)
	fmt.Println(Book2.title)
	printBook(Book2)
	printTitle(&Book1)
}
